package com.ebeitech.doorapp.view.setting;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.ebeitech.doorapp.BuildConfig;
import com.ebeitech.doorapp.R;
import com.ebeitech.doorapp.util.PublicUtil;
import com.ebeitech.doorapp.view.BaseActivity;
import com.ebeitech.library.util.CommonUtil;
import com.ebeitech.library.util.ViewUtil;

import java.io.File;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by alice on 2018/6/12.
 */

public class AboutActivity extends BaseActivity {

	@BindView(R.id.iv_QRCode)
	ImageView qrcCodeImage;
	@BindView(R.id.tv_version)
	TextView versionText;

	private Bitmap qrcBitmap;

	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentView(R.layout.ebei_activity_about);
		ButterKnife.bind(this);
		initView();
	}

	private void initView() {
		versionText.setText("当前版本：" + BuildConfig.appVersion);

		int widthPix = ViewUtil.dp2px(this, 100);
		String content = "http://w.yikb.cn/ios/menhu/download.html";
		String filePath = CommonUtil.getCacheFile(this) + "/" + "QRCode_IOS" + ".jpg";
		qrcBitmap = PublicUtil.createQRImage(content, widthPix, widthPix, null, filePath);
		if (qrcBitmap != null) {
			qrcCodeImage.setImageBitmap(qrcBitmap);
		}
	}
}
